Skip to content

feat: add get_model_presets and get_prompting_guide discovery tools#25

Merged
hybridindie merged 4 commits intomainfrom
copilot/feat-issue-18-model-presets-guides
Mar 12, 2026
Merged

feat: add get_model_presets and get_prompting_guide discovery tools#25
hybridindie merged 4 commits intomainfrom
copilot/feat-issue-18-model-presets-guides

Conversation

Copy link
Contributor

Copilot AI commented Mar 12, 2026

Adds two static, read-only discovery tools so LLMs can retrieve model-family-specific generation presets and prompt engineering guidance without needing to know ComfyUI internals.

Changes

  • get_model_presets(model_name?, model_family?) — returns recommended sampler, scheduler, steps, CFG, resolution, and clip_skip for a given family. Accepts explicit family name (sd15, sdxl, flux, sd3, cascade) or infers from model filename (e.g. flux1-dev-fp8.safetensorsflux). Normalizes common aliases (sd1.5, flux.1, sd3.5, stable-diffusion-xl, etc.).

  • get_prompting_guide(model_family) — returns prompt structure, weight syntax, quality tags, and negative-prompt tips per family.

  • Both tools call limiter.check() first and emit structured audit.log() entries. No API calls to ComfyUI — static data only.

  • _MODEL_FAMILY_ALIASES cleaned up: removed redundant self-mapping entries (sdxl, flux, sd3). Added explicit None guard after filename inference with a clear error rather than a misleading "Unknown model family: None".

  • 6 new tests in TestModelPresetsAndGuides covering direct lookup, filename inference, missing-input rejection, guide retrieval, unknown-family rejection, and unrecognized-filename rejection.

  • README discovery table updated with both tools.

Example

# Explicit family
await get_model_presets(model_family="flux")
# → {"family": "flux", "recommended": {"sampler": "euler", "cfg": 1.0, "steps": 20, ...}}

# Inferred from filename
await get_model_presets(model_name="dreamshaper_8.safetensors")
# → {"family": "sd15", "recommended": {"sampler": "euler_ancestral", "cfg": 7.0, ...}}

await get_prompting_guide("sdxl")
# → {"family": "sdxl", "guide": {"prompt_structure": "...", "weight_syntax": "(token:1.1)", ...}}
Original prompt

Open a PR from branch feat/issue-18-model-presets-guides into main with a concise summary and validation details. This branch implements issue #18 by adding two read-only discovery tools: get_model_presets and get_prompting_guide, adds tests in tests/test_tools_discovery.py, and updates README discovery tool docs. Ensure PR body includes: what was added, security/limiter/audit behavior, and validation commands/results. Include 'Closes #18'.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Closes #18

- Add get_model_presets(model_name|model_family) with family normalization,
  filename-based inference, and curated recommended generation settings.
- Add get_prompting_guide(model_family) with model-family prompt structure,
  weighting guidance, quality tags, and negative prompt tips.
- Apply read limiter and audit logging to both tools.
- Add tests for family lookup, inference, validation, and guide retrieval.
- Document new tools in README discovery table.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


You can also share your feedback on Copilot code review. Take the survey.

@hybridindie hybridindie force-pushed the copilot/feat-issue-18-model-presets-guides branch from 59e7daa to 1678a8e Compare March 12, 2026 18:13
@hybridindie hybridindie changed the title [WIP] Add model presets and prompting guide discovery tools feat: add model presets and prompting guide tools Mar 12, 2026
@hybridindie hybridindie marked this pull request as ready for review March 12, 2026 18:13
Copilot AI and others added 3 commits March 12, 2026 18:14
Closes #18

- Add get_model_presets(model_name|model_family): family normalization,
  filename-based inference, and curated recommended generation settings.
- Add get_prompting_guide(model_family): prompt structure, weight syntax,
  quality tags, and negative prompt tips per model family.
- Apply read limiter and audit logging to both tools.
- Removed redundant self-mapping aliases (sdxl, flux) from alias table.
- Explicit ValueError when model filename is unrecognized (None guard).
- 6 new tests covering family lookup, inference, validation, guide retrieval,
  unknown-family rejection, and unrecognized filename rejection.
- Document new tools in README discovery table.

Co-authored-by: hybridindie <20465+hybridindie@users.noreply.github.com>
Co-authored-by: hybridindie <20465+hybridindie@users.noreply.github.com>
Copilot AI changed the title feat: add model presets and prompting guide tools feat: add get_model_presets and get_prompting_guide discovery tools Mar 12, 2026
Copilot AI requested a review from hybridindie March 12, 2026 18:15
@hybridindie hybridindie merged commit 34042d4 into main Mar 12, 2026
hybridindie pushed a commit that referenced this pull request Mar 12, 2026
- Add negative TTL (5 min) to ModelManagerDetector so a late-starting
  Model Manager is detected without requiring server restart (#13)
- Add path injection prevention tests for prompt_id, node_class,
  task_id, and HTTP method validation (#19)
- Rewrite integration tests to use register_*_tools() return dicts
  instead of accessing private _tool_manager._tools SDK attrs (#20)
- Gate Docker image push on test/lint job success via needs: (#22)
- Fix docker-compose volume paths for non-root container user (#23)
- Document SSE transport security risks with warning callout (#24)
- Add audit vs enforce mode operational guidance table (#25)
- Add audit log rotation docs with logrotate example (#26)
- Remove duplicate row in threat model table (#52)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
hybridindie pushed a commit that referenced this pull request Mar 12, 2026
- Add negative TTL (5 min) to ModelManagerDetector so a late-starting
  Model Manager is detected without requiring server restart (#13)
- Add path injection prevention tests for prompt_id, node_class,
  task_id, and HTTP method validation (#19)
- Rewrite integration tests to use register_*_tools() return dicts
  instead of accessing private _tool_manager._tools SDK attrs (#20)
- Gate Docker image push on test/lint job success via needs: (#22)
- Fix docker-compose volume paths for non-root container user (#23)
- Document SSE transport security risks with warning callout (#24)
- Add audit vs enforce mode operational guidance table (#25)
- Add audit log rotation docs with logrotate example (#26)
- Remove duplicate row in threat model table (#52)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prompt engineering guides and model-specific presets

3 participants